package com.edu.neusoft.elec_shop.service;

import com.edu.neusoft.elec_shop.domain.Comments;
import com.edu.neusoft.elec_shop.mapper.CommentsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentsService {

    @Autowired
    private CommentsMapper commentsMapper;

    // 根据商品ID获取该商品的所有评论
    public List<Comments> getCommentsByGoodsId(Long goodsId) {return commentsMapper.selectCommentsByGoodsId(goodsId);}

    // 根据评论ID删除对应的评论
    public int deleteCommentById(Long userId) {return commentsMapper.deleteCommentById(userId);}

}